import os
import random

x = 5
y = 2

print(x / y)
print(x // y)
print(x % y)

print(-x)
print(+x)
print(int(x / y))

print(divmod(x, y))
import random

print(round(random.uniform(1, 20), 2))
print("Y 编码ascii ", ord('Y'))
print(chr(89))
print(r"\r")

from string import Template

s = Template("fsfs ${abd} is aegre ${ds}")
print(s.substitute(abd='34', ds=43))
print('Hello %s , good %s' % ('张三', 'afternoon'))
print("Hello {0}, good {1}".format('李四', 'evening'))
print(list("adefgbc"))
print(sorted("adgevs"))
aa = ''.join(sorted('adgebsw'))
print(aa)


def get_generator():
    for i in range(3):
        yield i


g = get_generator()
for i in g:
    print(i)

print({1, 2, 3, 4})

import time

t = time.localtime()
print(time.strftime("%Y-%m-%d %H:%M:%S.%S", t))
time.time()
# time.sleep(4)
print(time.altzone / 3600)
print(t)


class Cat():
    __cid = '1'

    def __run(self, speed):
        print('__cid是' + self.__cid + '的猫', '以' + speed + '的速度奔跑')

    def run(self, speed):
        self.__run(speed)

c = Cat()
c.run(str(20))
print(os.getcwd())
print(os.listdir(os.getcwd()))
print(os.path.abspath('.'))
print(os.path.split('E:/tmp.txt'))
# print(os.system('ping www.baidu.com'))
import subprocess
try:
    # 使用 subprocess.run 执行命令，并捕获输出
    result = subprocess.run(['ping', 'www.baidu.com'], capture_output=True, text=True, timeout=5)

    # 打印返回的标准输出和标准错误
    print("标准输出:")
    print(result.stdout)

    print("标准错误:")
    print(result.stderr)
except Exception:
    print("超时了...")


from enum import Enum

class WeekDay(Enum):
    Mon = 0
    Tue = 1
    Wed = 2
    Thu = 3
    Fri = 4

for day in WeekDay:
    # 枚举成员
    print(day)
    # 枚举成员名称
    print(day.name)
    # 枚举成员值
    print(day.value)
iter()
